text: Set the hotspot for the drag icon
authorMatthias Clasen <mclasen@redhat.com>
Mon, 7 Sep 2020 00:46:42 +0000 (20:46 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 7 Sep 2020 15:18:45 +0000 (11:18 -0400)
This makes the drag icon align properly with the
dragged text at the beginning of the drag.

gtk/gtktext.c

index 7e2f2308ebe470e2349f16a7e524199a518c699e..4fa9a77b215ffbacd2b38c21a9dd38c38971bcd5 100644 (file)
@@ -2986,7 +2986,9 @@ gtk_text_drag_gesture_update (GtkGestureDrag *gesture,
           g_signal_connect (drag, "cancel", G_CALLBACK (dnd_cancel_cb), self);
 
           paintable = gtk_text_util_create_drag_icon (widget, text, -1);
-          gtk_drag_icon_set_from_paintable (drag, paintable, ranges[0], 0);
+          gtk_drag_icon_set_from_paintable (drag, paintable,
+                                            (priv->drag_start_x - ranges[0]),
+                                            priv->drag_start_y);
           g_clear_object (&paintable);
 
           priv->drag = drag;